#include "database.h"

DataBase::DataBase()
{
    common = Common::GetInstance();
    absmax =1;
    absmin =0;
    acc = 1;
    max =0 ;
    min = 0;
    ave = 0.0f;
}
DataBase::~DataBase()
{

}

DataBase::DataBase(QString fileName)
{
    this->fileName = fileName;
    common = Common::GetInstance();
    //zoomIn =1;
    absmax =1;
    absmin =0;
    acc = 1;

    pointsNum =0;
    max =0 ;
    min = 0;
    ave = 0.0f;
}
DataBase::DataBase(QString fileName,DATAFORMAT dataFormat)
{
    this->fileName = fileName;
    this->dataFormat = dataFormat;
    common = Common::GetInstance();

    absmax =1;
    absmin =0;
    acc = 1;

    pointsNum =0;
    max =0 ;
    min = 0;
    ave = 0.0f;
}
QDateTime DataBase::getStartTime()
{
    QDateTime d;
    return d;
}

QDateTime DataBase::getStartTime(QString fileName)
{
    QDateTime d;
    return d;

}
int *DataBase::getData(LONG  start ,LONG  end,DATAFORMAT dataformat ,int pianyiPoint )
{

    return NULL;
}
LONG DataBase::getPointNumber()
{
    return 0;
}
LONG DataBase::getFileLength()
{
    QByteArray ba_input = this->fileName.toLocal8Bit();
    char *file = ba_input.data();
    FILE *fp= fopen64(file,"rb");
    if(fp!=NULL)
    {
        fseeko64(fp,0,SEEK_END);
        LONG length =ftello64(fp);
        fclose(fp);
        return length;
    }

    return 0;
}
int DataBase::getFreq()
{
    return 0;
}

void DataBase::setFreq(int freq)
{

}

QList< QVector <QPointF> > DataBase::get_Data(LONG pre,LONG end,int acc)
{
    QList< QVector <QPointF> > list;
    return list;
}

int DataBase::getPianyi()
{
    return 0;
}

QVector<QPointF> DataBase::get_PSegy_Data(LONG preNum, LONG lastNum)
{
    QVector<QPointF> v;
    return v;
}

double DataBase::getAbsmax()
{
    return absmax;
}

long DataBase::getMax()
{
    return max;
}

long DataBase::getMin()
{
    return min;
}

int DataBase::getTotalStaticApplied()
{
    return 0;
}
